#!/bin/sh
load ../rules.shmk
# option vars for libuse.input.parse_input()
LIBUSE_INPUT_PARSER_STD_LONG=stub
LIBUSE_INPUT_PARSER_STD_SHORT=stub
LIBUSE_INPUT_PARSER_STD_EXEC=stub


default() {
	libuse
}


libuse() {
	shpp -Dgit_rev=$git_rev -Dprefix=$PREFIX backup.in.sh  -o backup
	shpp -Dgit_rev=$git_rev winix_app.in.sh -o winix_app
	shpp -Dgit_rev=$git_rev wine_misc.in.sh -o wine_misc
	if [ $LIBUSE_INPUT_NEW ] ; then
		shpp -Dgit_rev=$git_rev -Dprefix=$PREFIX -DDEFAULT_STD_OPTIONS_LONG=$LIBUSE_INPUT_PARSER_STD_LONG \
		-DDEFAULT_STD_OPTIONS_SHORT=$LIBUSE_INPUT_PARSER_STD_SHORT -DDEFAULT_STD_OPTIONS_EXEC=$LIBUSE_INPUT_PARSER_STD_EXEC \
		input.in.sh -o input
	fi
	shpp -Dgit_rev=$git_rev -Dprefix=$PREFIX binput.in.sh -o binput
	shpp -Dgit_rev=$git_rev -Dprefix=$PREFIX libuse_v4.in.sh -o libuse_v4
	shpp -Dgit_rev=$git_rev -Dprefix=$PREFIX base.in.sh -o base
}

install() {
	mkdir -p $PREFIX/lib/libuse		
	install_libuse
}
install_libuse() {
	$INSTALL backup 	$PREFIX/lib/libuse/backup
	$INSTALL winix_app 	$PREFIX/lib/libuse/winix_app
	$INSTALL wine_misc 	$PREFIX/lib/libuse/wine_misc
	$INSTALL binput 	$PREFIX/lib/libuse/binput
	$INSTALL libuse_v4 	$PREFIX/lib/libuse/libuse_v4
	$INSTALL base 		$PREFIX/lib/libuse/base
	ln -s libuse_v4		$PREFIX/lib/libuse/libuse
}

clean() {
	rm -rf backup
	rm -rf winix_app
	rm -rf wine_misc
	rm -rf input_old
	rm -rf input
	rm -rf libuse_v4

}
